#!/bin/csh
#Syntax:   cat file.mse | taofit.job forcemin forcemax mommin mommax  > file.ps


set view_point 	= "290/15"

set forcemin = -11
set forcemax = -7
set mommin   = -15
set mommax   = -10

set forcemin	= $1
set forcemax	= $2
set mommin	= $3
set mommax	= $4

echo $forcemin / $forcemax / $mommin / $mommax

gawk '{if ($1!=">") print $3/1e12,$2/1e16, $4; else print ">"}' > tmp
gawk '{if ($1!=">") print $1,$2,$3 ; }' tmp > tmp3
gawk '{print $1,$2, 0 }' tmp > tmp2

psbasemap -B:"Force (TN m@+-1@+)":a1f.5g10/:"Moment (10@+16@+N m m@+-1@+)":a1f.5g10/a100f50g100:Error:NSEWZ+ \
	-JX6 -JZ5 -R$forcemin/$forcemax/$mommin/$mommax/0/500 -E$view_point -K	#-G0/255/255
cat tmp2| psxyz -JX -JZ -R -E$view_point -M -W2/255/0/0 -O -K 
cat tmp | psxyz -JX -JZ -R -E$view_point -M -W5/50/0/0 -O

#blockmean tmp3 -I.02 -R$forcemin/$forcemax/$mommin/$mommax |\
surface tmp3 -Gtmp.bin -I.02 -T1 -R$forcemin/$forcemax/$mommin/$mommax
grd2cpt tmp.bin > tmp.cpt
psbasemap -JX -R -B:"Force (TN m@+-1@+)":a1f.5g10/:"Moment (10@+16@+N m m@+-1@+)":a1f.5g10/a100f50g100:Error:nSeW -X2 -K 						
grdimage	tmp.bin -Ctmp.cpt -JX -R -O -K  			
grdcontour	tmp.bin -JX -R -C50 -A100f12 -W3/255 -O -K		
psxy		tmp -JX -R -St.02 -O 



rm -f tmp* 
